package com.supcon.exchangedata.repository.master;

import com.supcon.exchangedata.pojo.entity.oracle.StatistOtherParametersHour;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yangbin
 * @Date: 2022/03/18/9:36
 * @Description:
 */
public interface MasterStatistOtherParametersHourRepository extends JpaRepository<StatistOtherParametersHour, Long> {
    public StatistOtherParametersHour findByObjIdAndTypeAndCollectDateAndCollectHour(Long objId, Long type, LocalDateTime collectDate,Integer collectHour);

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query("update StatistOtherParametersHour s set s.inAvgValue = ?1 where s.objId =?2 and s.collectDate =?3 and s.type = ?4 and s.collectHour = ?5")
    void updateHour(Double valueOf, Long objId, LocalDateTime dayOfMonthKey, Long type, Integer hour);
}
